UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'E3VUUIzhg0oRupYDJjknE/q4iHombqrA8nmrZmWmd74='
WHERE
key_id = 'a7317a16bd0cb414dfe863e3de0fd2b32e516f864235b2fca5dfbb2ac7606b95'
AND (
token = 'E3VUUIzhg0oRupYDJjknE/q4iHombqrA8nmrZmWmd74='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)