UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'GjAQVRcJjwEZgn315sP3ss15JkCP2i32AWW7icvHgYM='
WHERE
key_id = 'e3aa41a70fa54a69bd13308d22126f8a7847fe80d7c80fee9ccc44c1339bf3f0'
AND (
token = 'GjAQVRcJjwEZgn315sP3ss15JkCP2i32AWW7icvHgYM='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)