UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'dgRlM0DIpu+8zGPzCHopGi1VzojpodjydZ2sAYA7Y1w=' 
WHERE 
  key_id = '61f0d8b87e2e575fdc3c5e15d804dff8cce99aadbd1fbb904d56b0e0a2e73811' 
  AND (
    token = 'dgRlM0DIpu+8zGPzCHopGi1VzojpodjydZ2sAYA7Y1w=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034