UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'kd6HC9sUHvFHkJ9YikX4q6in+LhgDvW9R7kfNWhCBi8='
WHERE
key_id = 'f6fa5e1e3087a2c68e2643208c5692fd9d21684816a05ab8f0522a8c91f2fd29'
AND (
token = 'kd6HC9sUHvFHkJ9YikX4q6in+LhgDvW9R7kfNWhCBi8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)