UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '6PQE2IJp6emblxMss/q4hXmmlGYjFYjUUQLmkwyfa9Q='
WHERE
key_id = 'd57c140ebdc36d649b4c4e5410c18d87e39b784241d4a598f76db67196614dc4'
AND (
token = '6PQE2IJp6emblxMss/q4hXmmlGYjFYjUUQLmkwyfa9Q='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)