UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '2mz9wA6e4ys7XsCc6LVHziODGeMKZuDyGUQnrgsnXco=' 
WHERE 
  key_id = '683e3d619478d5bd48b23c831940e8f20397370a59f9fc7192ec261add090df7' 
  AND (
    token = '2mz9wA6e4ys7XsCc6LVHziODGeMKZuDyGUQnrgsnXco=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032