UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'd0lvhhCSW5hDG9wsAvKcjUcIw25ZbYkcR3f8bW+moGs='
WHERE
key_id = 'b3e86cb29766fb9ca97b3672d42ccd1ce68907acf8b0473b6891511386d8040c'
AND (
token = 'd0lvhhCSW5hDG9wsAvKcjUcIw25ZbYkcR3f8bW+moGs='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)