UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'z6/qwUC6XfXTf36AQe0xNyrjNIAz4+y1khBdsDbEDY8=' 
WHERE 
  key_id = 'a981aa09ed47c53cdbc8b5e735bb83c4aa266b4dbd04d060ecb719b6b7e6840d' 
  AND (
    token = 'z6/qwUC6XfXTf36AQe0xNyrjNIAz4+y1khBdsDbEDY8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028