UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Zw/fbe3iJgb7lOg2stRYaxFM7Rs7nfVJivfHslhik5Q=' 
WHERE 
  key_id = '7a7492c7d63bd899601acc653fc243a07a835d71086d04c4a06558b456356a47' 
  AND (
    token = 'Zw/fbe3iJgb7lOg2stRYaxFM7Rs7nfVJivfHslhik5Q=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025