UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'bSyOPCZUCL2vqOdmEBblAxYw9oPpgLNkfOxIL0PAiGk=' 
WHERE 
  key_id = 'b46bbbf7670e2eb72fc3356821a7a36538ad759929b4fda3213115d6611d09ad' 
  AND (
    token = 'bSyOPCZUCL2vqOdmEBblAxYw9oPpgLNkfOxIL0PAiGk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00045