UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'oX6ggfcJ5hJuQSBnTSqxgQn+PuV6xUuWMGwITl2NT+g=' 
WHERE 
  key_id = '68fd4f6ca3e0e61931392024996c13bcbb2ff930d0e60587d5d337b74b3e9ab9' 
  AND (
    token = 'oX6ggfcJ5hJuQSBnTSqxgQn+PuV6xUuWMGwITl2NT+g=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031