UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '4XUvgYPVYOWzvvBsZPQyFAH7NBRcVi18Yelfu338YC4='
WHERE
key_id = 'e2bec3cd5ad31b11114f475581df1e5d4720ba93e77c4dae635ac96c982a6520'
AND (
token = '4XUvgYPVYOWzvvBsZPQyFAH7NBRcVi18Yelfu338YC4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)