UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'vQoaPAEMXEq9Ep5p7FbC+rp3RsBKzMJ+ElGA9mpvRrg=' 
WHERE 
  key_id = 'd703de8a701a3df8c1226295b1c4b814ee468e76875124499e5b94047550b7ab' 
  AND (
    token = 'vQoaPAEMXEq9Ep5p7FbC+rp3RsBKzMJ+ElGA9mpvRrg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00058