UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'pWwa0RKWvVSm1hNTsnAuhH36YAFsYgsUY36W/Fyvskw='
WHERE
key_id = 'c51504b000accf69c39ae09ab472b636a611349146cb4ed0e8dd146c5fd9c9fc'
AND (
token = 'pWwa0RKWvVSm1hNTsnAuhH36YAFsYgsUY36W/Fyvskw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)