UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'c1y6tdA+Ttk4l8OHFjtO74dX58EwXnOTyKTVouvKgrM='
WHERE
key_id = '087f41018cf1983458a664acf62f0e554c39db40d4023ca74b7ebc6e27509820'
AND (
token = 'c1y6tdA+Ttk4l8OHFjtO74dX58EwXnOTyKTVouvKgrM='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)