UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '8oyvAh2JKq4kUgaa5JMweAAtpqceBGsxmBasdk2y3cA=' 
WHERE 
  key_id = 'f9f52a16d1396ddf8dbdd5bfc06731d0a7586b3705cfa12dfdd0dbaa7a0bb312' 
  AND (
    token = '8oyvAh2JKq4kUgaa5JMweAAtpqceBGsxmBasdk2y3cA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027