UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'SmDqAT21/CyZ97TZ6hXBavz5GiTLia/+9h5JhZKTs/8='
WHERE
key_id = '3123137c21452a121c2aef15e90f4808fa5d26e59b2f832a530808db54ed3810'
AND (
token = 'SmDqAT21/CyZ97TZ6hXBavz5GiTLia/+9h5JhZKTs/8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)