UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '9+MtqOlgFDWC8O6pFSkh4WvaLsMeqFLlotT2zZZ43Ik=' 
WHERE 
  key_id = 'd1dfd2a0b98b2d8cf6b05d900bc189030b4134f1d49a591ec052d01b22b2e78a' 
  AND (
    token = '9+MtqOlgFDWC8O6pFSkh4WvaLsMeqFLlotT2zZZ43Ik=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023