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