UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'XKLHjZGccPzGNNzj4B2RtEgfCU9MIECC/J4sRzdqhBc=' 
WHERE 
  key_id = '18c71066debe8effdf2328137eb553915db7f9e9b450038dea7204dea083479a' 
  AND (
    token = 'XKLHjZGccPzGNNzj4B2RtEgfCU9MIECC/J4sRzdqhBc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038