UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'KU+PbOyYZma9I6hbzfRbiz2vM7notHrf0Bu+mbZXRCU='
WHERE
key_id = '2c1171d23a7cbc70c439ad00f24965a54b52bb0cf76500a26429755bc750eed9'
AND (
token = 'KU+PbOyYZma9I6hbzfRbiz2vM7notHrf0Bu+mbZXRCU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)