UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ygF1xEkknDTmNVWrfYbaMH0dMeaupAYYYkvu3ZQ+LFY=' 
WHERE 
  key_id = 'a95b54df971ba7c407464b4391206ab2e317e7680a28edbbde7a25cf3583fe47' 
  AND (
    token = 'ygF1xEkknDTmNVWrfYbaMH0dMeaupAYYYkvu3ZQ+LFY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00042