UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'U2pk3P5r95skfX56FUGrj8WP/uuEgO8Pn3dj90LENS8='
WHERE
key_id = 'a6509a53e645973548e54f02714bf1c030e4167f3b874e09c4798ea44a2bfe8c'
AND (
token = 'U2pk3P5r95skfX56FUGrj8WP/uuEgO8Pn3dj90LENS8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)