UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'fIVC3bOa/YOdCziXJIZ4J5n4gjVSJKxDEoqqxab5lt8=' 
WHERE 
  key_id = 'b9dc1dc1be2be333bd99f81dc1225257c33b6413eb1095a1ac744c125ecc234a' 
  AND (
    token = 'fIVC3bOa/YOdCziXJIZ4J5n4gjVSJKxDEoqqxab5lt8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036