UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'mJP9eTnFLiH1ohXV1CLAIlSOBuWFQ58BYHB5I7K4/hk='
WHERE
key_id = 'ba4de653800bc14c5eb046fc798f4ac9c4916c280fe3b1a6e81339a2fdc41163'
AND (
token = 'mJP9eTnFLiH1ohXV1CLAIlSOBuWFQ58BYHB5I7K4/hk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)