UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'fMAzjyG0DGjxKw62/7UsA5fxRDGrNybr29pcL90hgA4='
WHERE
key_id = 'b08a58f2ce5337e433b0f16a84be59063cf1cc6d3f536d6d1281d091af2ad18d'
AND (
token = 'fMAzjyG0DGjxKw62/7UsA5fxRDGrNybr29pcL90hgA4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)