UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'XPb1nHq6ahRBR2zkAfgfZ/7GD1Gn0jqdDEEp8exlOfo='
WHERE
key_id = 'f4a4adde394f442cbdecd81ce65af472ef4c0d27cf04a8169b3025192e4de757'
AND (
token = 'XPb1nHq6ahRBR2zkAfgfZ/7GD1Gn0jqdDEEp8exlOfo='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)