UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'YkjmKp9Yg4wBD+uLbZNqcSJBsxlGQsfN6OClLAyOHjQ='
WHERE
key_id = '089a1a33a0204c1aa30bcef5755e8f2aca99f7f1a9626019012d61faf964d8ef'
AND (
token = 'YkjmKp9Yg4wBD+uLbZNqcSJBsxlGQsfN6OClLAyOHjQ='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)