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