UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'X4LQwgElEvstLfFouAMZzflG9Tz+smuqQY16Q70NFXM=' 
WHERE 
  key_id = 'ca9ba1f830eedbf8790548904bc0618f2bd8bef23bafcf80042b7a99e95157a3' 
  AND (
    token = 'X4LQwgElEvstLfFouAMZzflG9Tz+smuqQY16Q70NFXM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030