UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'dF+zZfoK0Vcv49CN/dDCCXW2syQwUuKPYuJ7DOKWK68=' 
WHERE 
  key_id = '17d342ee2007a15925cc58a90e5d69d7bed7b0012122e42190d7586be3af336a' 
  AND (
    token = 'dF+zZfoK0Vcv49CN/dDCCXW2syQwUuKPYuJ7DOKWK68=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036