UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'rDOpHLp9g68YM99+BMjoQG2ARwMNKn87d5B6Hwq1PMU=' 
WHERE 
  key_id = 'b4b8bf7c8493a0aabc8d9038631d5f722a00cc8ef0feb379d085a3b2b319737c' 
  AND (
    token = 'rDOpHLp9g68YM99+BMjoQG2ARwMNKn87d5B6Hwq1PMU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034