UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'HoHnk5BJRRCdkn6lCEGk3cl/KN0tIbSU2OI4Zbko3Ws=' 
WHERE 
  key_id = '6051989871a26d1305534a46805eb2fb99c344408e9a31aa95382f78e2d308c8' 
  AND (
    token = 'HoHnk5BJRRCdkn6lCEGk3cl/KN0tIbSU2OI4Zbko3Ws=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00018