UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'rrzMC3l5K36buZyFdcvqLKr4glimE8vqz7N/JtZFkiA=' 
WHERE 
  key_id = '007a3db76e987b291700fc0b96a09259bab2b2bbabdce6f067d190880c845e08' 
  AND (
    token = 'rrzMC3l5K36buZyFdcvqLKr4glimE8vqz7N/JtZFkiA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038