UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Dfna4O4zvwF8+HYpBsCSzLYQ8ClrfJuEwqGffYYxhv0=' 
WHERE 
  key_id = '2509612489f0f034931f254e074d7c35cf8ddcacecb81b2d9f5e807fdc33f7a6' 
  AND (
    token = 'Dfna4O4zvwF8+HYpBsCSzLYQ8ClrfJuEwqGffYYxhv0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037