UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'n/FMoCV1j9dDWsFZdquhIh1UbE6HzdKLlOKtZn73lV8=' 
WHERE 
  key_id = 'f74213a4e24b520c146c2cd491b2cf47848f786823551d552b1dbb6efd9f7b46' 
  AND (
    token = 'n/FMoCV1j9dDWsFZdquhIh1UbE6HzdKLlOKtZn73lV8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00021