UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '54IwGWtIluzIU9oPCLTkfzuIYClJFTZItdiIiprzFgk='
WHERE
key_id = '502008ea9dff34fb01d7124edfd8b3c5c41a3bc66493438146743cbaca59a172'
AND (
token = '54IwGWtIluzIU9oPCLTkfzuIYClJFTZItdiIiprzFgk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)