UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'yL6bmq1UD9NvqAG7NcaseHxIxAgU0W7n0yrDygOI7rY=' 
WHERE 
  key_id = '360992784686b5938e2c94e449ab7c774afc5b517e3587fafb488c7505e5fd86' 
  AND (
    token = 'yL6bmq1UD9NvqAG7NcaseHxIxAgU0W7n0yrDygOI7rY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035