UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '4K4JUTFnAoHk01evDMuWMXATHCgxYYQ/BthaKxNwGRU=' 
WHERE 
  key_id = 'bc5bd539594d46232b4a52c4f532d9269a23470597cd3516cb49cc2c0d1785de' 
  AND (
    token = '4K4JUTFnAoHk01evDMuWMXATHCgxYYQ/BthaKxNwGRU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034