UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '2JaefkBsf1IAXrRSuIj2B8hx40DaAMvczfQwRVhfhIw='
WHERE
key_id = '6c4e82ddab19ad0f3d762faa646572a3188a00868e4deaa5254343fddc6bc4e3'
AND (
token = '2JaefkBsf1IAXrRSuIj2B8hx40DaAMvczfQwRVhfhIw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)