UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'AgYfjRObpn/5S31ZWMLPg8cBsQFzEHCWIO7x+nrNhxM='
WHERE
key_id = 'cedf3cbd14f38965ea1fb73b92f3e5d1e63f48aa46371a31f54c6f1d977bef35'
AND (
token = 'AgYfjRObpn/5S31ZWMLPg8cBsQFzEHCWIO7x+nrNhxM='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)