UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'SgQGXNPdmDfbvBiI4ChTNjOHfAVZgQEvCXQ2tFm1C8k='
WHERE
key_id = '685ab8cd5705adcc73a008340f38d535a7196cad1ac8d27f9ba22ff200948b10'
AND (
token = 'SgQGXNPdmDfbvBiI4ChTNjOHfAVZgQEvCXQ2tFm1C8k='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)