UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Y45qxn2cYwqS9Em6IDaIadjaxdht9ua7+JyVidcXw/8=' 
WHERE 
  key_id = '3714083ff8d2ae3584749b798f4ce6b01ae145d5f4b26edb8b78209bd5920696' 
  AND (
    token = 'Y45qxn2cYwqS9Em6IDaIadjaxdht9ua7+JyVidcXw/8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031