UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'gf069vjn6AknOJd7Hdf4m8KMp2Bok4x8IA9+P60ZylI='
WHERE
key_id = '80c30611529cf6623a7a876f3b6ce84b3e2f0d94ec48310cb6690526222b9c91'
AND (
token = 'gf069vjn6AknOJd7Hdf4m8KMp2Bok4x8IA9+P60ZylI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)