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